package orz.itrip.biz.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import orz.itrip.DtoUtils;
import orz.itrip.biz.service.HotelService;
import orz.itrip.dto.Dto;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/hotel/")
@Api(tags = "酒店",description = "文档说明",hidden = true)
public class HotelController {

    @Resource
    private HotelService hotelService;

    @GetMapping(value = "getvideodesc/{hotelId}",headers = "token")
    @ApiOperation( value = "查询酒店视频详情",notes = "查询酒店视频详情")
    public Dto getvideodesc(@PathVariable Long hotelId, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.getvideodesc(hotelId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "queryhoteldetails/{hotelId}",headers = "token")
    @ApiOperation( value = "查询酒店详情",notes = "查询酒店详情")
    public Dto queryhoteldetails(@PathVariable Long hotelId, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.queryhoteldetails(hotelId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "queryhotelfacilities/{hotelId}",headers = "token")
    @ApiOperation( value = "查询酒店特点详情",notes = "查询酒店特点详情")
    public Dto queryhotelfacilities(@PathVariable Long hotelId, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.queryhotelfacilities(hotelId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "queryhotelpolicy/{hotelId}",headers = "token")
    @ApiOperation( value = "查询酒店规则详情",notes = "查询酒店规则详情")
    public Dto queryhotelpolicy(@PathVariable Long hotelId, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.queryhotelpolicy(hotelId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "getimg/{hotelId}",headers = "token")
    @ApiOperation( value = "查询酒店图片",notes = "查询酒店图片")
    public Dto getimg(@PathVariable Long hotelId, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.getimg(hotelId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "queryhotcity/{isChina}",headers = "token")
    @ApiOperation( value = "查询酒店图片",notes = "查询酒店图片")
    public Dto queryhotcity(@PathVariable Long isChina, HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.queryhotcity(isChina);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "queryhotelfeature",headers = "token")
    @ApiOperation( value = "查询酒店图片",notes = "查询酒店图片")
    public Dto queryhotelfeature(HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.queryhotelfeature();
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }

    @GetMapping(value = "querytradearea/{cityId}",headers = "token")
    @ApiOperation( value = "查询酒店图片",notes = "查询酒店图片")
    public Dto querytradearea(@PathVariable Long cityId,HttpServletRequest request){
        if (!StringUtils.isEmpty(request.getHeader("token"))){
            return hotelService.querytradearea(cityId);
        }
        return DtoUtils.getFalseDto("token失效，请重登录","100000");
    }
}
